package com.open.party.cloud.view.task.adapter;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;

import androidx.annotation.NonNull;

import com.bumptech.glide.Glide;
import com.open.party.cloud.R;
import com.open.party.cloud.model.FileEntity;

/**
 * 设备情况图片显示适配器
 */
public class EmergencyPhotoAdapter extends SimpleBaseAdapter<FileEntity, EmergencyPhotoAdapter.ViewHolder> {

    public EmergencyPhotoAdapter(Context context) {
        super(context);
    }

    @Override
    protected int getLayoutId() {
        return R.layout.image_show_view_common;
    }

    @Override
    protected void bindView(ViewHolder viewHolder, FileEntity fileEntity, final int position) {
        Glide.with(context).load(fileEntity.getFilePath()).placeholder(R.drawable.default_img).error(R.drawable.default_img).into(viewHolder.imgView);
    }

    @NonNull
    @Override
    protected ViewHolder onNewViewHolder(View view) {
        return new ViewHolder(view);
    }

    static class ViewHolder {

        ImageView imgView;

        ViewHolder(View view) {
            imgView = view.findViewById(R.id.iv_album_selected);
        }
    }
}
